package com.project.poetry.service.controller;

import com.project.poetry.service.entity.dto.comment.CommentDTO;
import com.project.poetry.service.entity.po.user.UserPO;
import com.project.poetry.service.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

/**
 * 评论/追评控制器
 * @author mengxj
 */
@Api("追评")
@RestController
@RequestMapping("comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @ApiOperation("发布评论/追评")
    @PostMapping("releaseComment")
    public void releaseComment(@RequestBody CommentDTO comment, @ApiIgnore UserPO user){
        this.commentService.releaseComment(comment, user);
    }

    @ApiOperation("删除评论/追评")
    @DeleteMapping("deleteById/{commentId}")
    public void deleteById(@PathVariable("commentId") Long commentId){
        this.commentService.deleteById(commentId);
    }
}
